
(defun flatten-list (alist)
  (reduce
    (lambda (x y) (append x y))
    alist))

(defun p29 (&optional (n 100))
  (length
  (remove-duplicates
    (flatten-list
    (loop for i from 2 to n
          collect (loop for j from 2 to n
;;                      collect (list i j))))
                        collect (expt i j)))))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun eluer29 ()
(length
 (remove-duplicates
   (loop for i from 2 to 100
         append (loop for j from 2 to 100
                 collect (expt i j))))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(format t "~a~%" (time (p29)))
(format t "~a~%" (time (eluer29)))
